import request from '@/utils/request'

/**
 * 查询供应联盟商品列表分页
 * 没有企业id，就获取全部供应联盟商品
 * by zhengjl 2021年7月2日09:22:00
 * @param query
 */
export function pagingSupplyAllianceGoodsList(query) {
  return request({
    url: '/goods/projectGoodsSupplyAlliance/paging',
    method: 'get',
    params: query
  })
}

// 获取供应联盟商品详情
export function getSupplyAllianceGoodsInfo(goodsId, enterpriseId) {
  if (!goodsId) {
    return false
  }
  var query = {
    goodsId: goodsId,
    enterpriseId: enterpriseId
  }
  return request({
    url: '/goods/projectGoodsSupplyAlliance/getSupplyAllianceGoodsInfo',
    method: 'get',
    params: query
  })
}
/**
 * 保存供货联盟商品到企业的分销商品
 * @param {Object} goodsId
 * @param {Object} enterpriseId
 * @param {Object} enterpriseGoodsCategoryId
 */
export function saveJoinProjectGoods(goodsId, enterpriseId, enterpriseGoodsCategoryId) {
  if (!goodsId) {
    return false
  }
  var query = {
    goodsId: goodsId,
    enterpriseId: enterpriseId,
    enterpriseGoodsCategoryId: enterpriseGoodsCategoryId
  }
  return request({
    url: '/goods/projectGoodsSupplyAlliance/saveJoinProjectGoods',
    method: 'get',
    params: query
  })
}

// 保存供货联盟商品设置参数
export function saveSupplyAllianceGoodsData(goodsEntity) {
  return request({
    url: '/goods/projectGoodsSupplyAlliance/saveSupplyAllianceGoodsData',
    method: 'post',
    data: goodsEntity
  })
}
// 清空更新类型
export function updateClearSupplyAllianceGoodsType(goodsId) {
  return request({
    url: '/goods/projectGoodsSupplyAlliance/updateClearSupplyAllianceGoodsType',
    method: 'get',
    params: { goodsId: goodsId }
  })
}
